home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-01-20 | 44.3 KB | 1,573 lines |
- Newsgroups: comp.sources.misc
- From: tony@ajfcal.cuc.ab.ca (Tony Field)
- Subject: v27i098: psf3 - Postscript print filter system, v3, Part07/09
- Message-ID: <1992Jan21.013457.11741@sparky.imd.sterling.com>
- X-Md4-Signature: 54b321998944723eb6e89faa2c87bfa4
- Date: Tue, 21 Jan 1992 01:34:57 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: tony@ajfcal.cuc.ab.ca (Tony Field)
- Posting-number: Volume 27, Issue 98
- Archive-name: psf3/part07
- Environment: ISC, SUNOS, SYSVR3, DOS
- Supersedes: psf2: Volume 12, Issue 4-9
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 7 (of 9)."
- # Contents: Install.lpd psfbanner.c psfdoub.c
- # Wrapped by ajf@trifid on Sat Jan 18 22:55:50 1992
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'Install.lpd' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Install.lpd'\"
- else
- echo shar: Extracting \"'Install.lpd'\" \(11083 characters\)
- sed "s/^X//" >'Install.lpd' <<'END_OF_FILE'
- X PSF AND LPR/LPD
- X
- X 1. If the psf systems has been successfully compiled and
- X installed with the sequence of commands (see Install.unix):
- X
- X make all
- X make printer
- X make scripts
- X make install
- X
- X filters and a suitable /etc/printcap file should be constructed
- X as outlined below.
- X
- X The "make install" process set links to psflpd for a few page
- X layouts. Since the the sample set of links may not be
- X appropriate, the links may be deleted and/or a new set of links
- X added. Read the instructions below to set options for various
- X links to psflpd.
- X
- X A sample printcap entry using the various filters was created
- X during the "make script" process and placed in file "printcap".
- X Use this document and the sample printcap file as a guide to
- X construct a suitable printcap file and construction of other
- X filters for your site.
- X
- X File printcap.NET is a sample printcap for network hosts that
- X wish to access a server host.
- X
- X In any case, psf may always be used at the command line since
- X psflpd and friends do not reprocess any text that is already
- X in postscript format:
- X
- X e.g. psf -4x this.txt | lpr
- X
- X
- X 2. FILTER NAMING, PSFPRINT.DEF
- X
- X The programme "psflpd" is the binary used for print filtering by
- X lpd. Lpd does not pass sufficient parameters to print filters to
- X allow selection of various options supported by psflpd. To get
- X around this problem, links to psflpd can be constructed which
- X invoke different print options. The desired print options
- X for each link name are manually edited into psfprint.def.
- X These lines must be at the beginning of the file. (A full
- X example of a psfprint.def file with print options is given
- X at the end of this document.)
- X
- X For example, if a link were made:
- X
- X ln psflpd p2up
- X
- X then, if p2up were executed as a print filter, it would
- X print the page 2-up in portrait layout. The associated
- X printcap entry would use p2up as the print "if" or "of"
- X filter:
- X if=/usr/local/lib/psf/p2up
- X
- X The entry in psfprint.def defining the options for use
- X with the p2up filter would look like:
- X
- X *psflpd p2up -2
- X
- X The general format of the entries placed in psfprint.def is:
- X
- X *psflpd <linkname> <opt> <opt> ... #comment
- X
- X where *psflpd identifies the line for psflpd option selection.
- X <linkname> the name of the link to psflpd
- X <opt> any psf(1) option (except that quoted
- X options are not allowed. e.g. -H "text line"
- X is not permitted)
- X
- X A selection of (hopefully) useful link names and option entries
- X was created by "make printer" and placed in psfprint.def. The
- X associated links to lpd were created by "make install"
- X
- X Edit psfprint.def, create new links to psflpd, and modify the
- X print cap entries for different print options. For example,
- X If you have a "General Accounting" package that requires special
- X print formatting, a link to psflpd could be set up with the
- X exact options neccesary for the print layout. Typically,
- X such reports print 66 lines on a page, 6 of which are used
- X to emulate a "skip to head of forms". A suitable set of
- X print options for such a report would be:
- X
- X *psflpd paccount -c132 -l60 -R2 -r6 -w
- X
- X This would cause the printout to be 132 columns by 60 lines
- X in landscape layout. Two lines would be removed from the
- X beginning of the file, and 6 lines between pages.
- X
- X
- X 3. CREATION OF /ETC/PRINTCAP ENTRIES
- X
- X A sample file "printcap" was created during the install. Use the
- X sample file and/or commentary below to construct a printcap
- X entry for your system. ( Examine printcap.NET to set up printcap
- X entries for network hosts needing access to a print server. )
- X
- X The general strategy is to create a series of printer names that
- X are representative of options desired. For example, the printer
- X name "2up" suggest that the pages will be printed 2-up.
- X
- X For each printer defined, set the name of the input (if=) or
- X output (of=) filter to the name of a link to psflpd.
- X
- X For each link created, edit psfprint.def to set the print
- X options associated with the link name.
- X
- X The various aliases of psflpd created by links should be used as
- X output (of=) filters. Ensure that the form feed character is
- X suppressed with the :sf printcap (or possibly use the ff=\0
- X printcap).
- X
- X # sample /etc/printcap entry for psflpd (or links)
- X # lp uses psflpd = normal page print, 12 point, portrait
- X # 2up uses psl2up = print 2 up on a page, landscape
- X # acct uses paccount = 132x60 page on letter paper
- X
- X lp|standard postscript:\
- X :lp=/dev/lp:sd=/usr/spool/lpd/lp:\
- X :lf=/usr/adm/lpd-errs: \
- X :if=/usr/lib/lpdfilters/psf/psflpd:sh:sf
- X
- X 2up|2up postscript:\
- X :lp=/dev/lp:sd=/usr/spool/lpd/lp:\
- X :lf=/usr/adm/lpd-errs: \
- X :if=/usr/lib/lpdfilters/psf/p2up:sh:sf
- X
- X acct|gen accounting:\
- X :lp=/dev/lp:sd=/usr/spool/lpd/lp:\
- X :lf=/usr/adm/lpd-errs: \
- X :if=/usr/lib/lpdfilters/psf/paccount:sh:sf
- X
- X No entry for "psflpd" is needed in psfprint.def. However,
- X they should be made for "p2up" and "paccount" and look like:
- X
- X *psflpd p2up -2
- X *psflpd paccount -c132 -l60 -R2 -r6 -w
- X
- X Links for p2up and paccount should be made:
- X
- X ln psflpd ps2up
- X ln psflpd paccount
- X
- X 4. The example printcap entries above use the input (if=) filter
- X and suppresses the banner page. If you wish to print the banner
- X page, remove the ":sh" and use output (of=) filters.
- X
- X The output (of=) filters also process the banner page generated
- X by lpd. The input (if=) filters do not. (The output (of=)
- X filters may be more efficient: I think that the of= filter is
- X executed once for a group of files, while the input (if=) filer
- X is invoked for every file being printed in a group.)
- X
- X If banner printing IS desired, use psflpd and friends as an "of="
- X filter. Beware that the banner page will probably be truncated if
- X printing is in portrat layout.
- X
- X If banner printing is NOT desired, use psflpd and friends as an
- X "if=" or "of=" filter and suppress banners with :sh.
- X
- X If you are not happy with the banner page layout printed by your
- X postscript printer, then the only suggestion I have is to modify
- X the sources for lpd!
- X
- X
- X 5. PRINTING POSTSCRIPT SOURCE
- X
- X If Postscript code must be printed, filter the source manually
- X with psf - otherwise the psflpd will pass the code to the
- X printer for execution:
- X
- X psf mycode.ps | lp
- X
- X As an alternative, a link to psflpd could be set up such that
- X the associated print options use the "-z" switch to force the
- X printing of the postscript code. A sample printer printcap entry
- X (post) to allow printing of postscript source was set up during
- X the install process. Usage:
- X
- X lpr -Ppost mycode.ps
- X
- X
- X 6. MULTIPLE PRINTER SUPPORT
- X
- X If these filters are to control multiple different postscript
- X printers on the same system, then separate editions of psflpd
- X and friends should be compiled an placed in different directores:
- X one for each different printer. For example, if you have a
- X Nec and and Apple postscript printer, place the binaries and
- X psfprint.def files in a directory that reflects each printer:
- X
- X /usr/lib/lpdfilters/nec/*
- X -and-
- X /usr/lib/lpdfilters/apple/*
- X
- X Modify the Makefile to compile for each set of directories.
- X
- X Rename each version of psf (for interactive use) to an
- X appropriate unique name (psfn and psfa). An alternative is ask
- X the user to use the "-u alt.def" option of psf when selecting
- X different printers.
- X
- X The Makefile allows you to change target directories and binary
- X programme names. Be careful when you "make install" after
- X major changes (use "make -n installbsd" to check things out).
- X
- X
- X 7. HOW DOES A USER ACCESS THE APPROPRIATE PRINTER?
- X
- X Any of the printers defined in /etc/printcap may be selected
- X depending upon the desired page layout! General printing to the
- X default printer "lp" would be done with:
- X
- X lpr my.file
- X
- X Two up printing would be done with:
- X
- X lpr -P2up my.file
- X
- X As another example, an MSDOS user with Wollongong tcp/ip might
- X print a file from dos with:
- X
- X lpr -P 2up source.c <-sends for 2up printing
- X - or -
- X lprint <- set up Wollongong printers
- X lprq lpt1 ajfcal:2up <- set lpt1 = up printing
- X lprq lpt3 ajfcal:lp <- set lpt3 = standard printing
- X
- X copy source.c lpt1 <- prints 2up on a page
- X copy other.txt lpt3 <- prints 1up on a page
- X
- X psf source.c > lpt1 <- since psf already formats the
- X text on dos, sending it to
- X any printer on ajfcal simply
- X passes the already done
- X postscript to the printer
- X without additional
- X processing.
- X
- X With Wollongong tcp/ips on dos, the pc can be readily set up
- X as a print server to serve other dos and/or unix systems.
- X However, psf cannot be used on the dos server as a filter
- X because the dos-side print server does not allow additional
- X filtering. Thus the client must first format with psf before
- X sending to the dos print server:
- X
- X psf -4xh source.c | lpr -Pdoslpr
- X
- X
- X 8. PRINTING PROBLEMS
- X
- X The most common problem associated with lpd and postscript
- X printers is the lack of printed output: files appear to be
- X printing, however the printer times out and nothing is actually
- X printed. Generally, this is caused by an invalid set of
- X /etc/printcap options that allow lpd to send some characters to
- X the printer without having those characters encapsulated in
- X postscript.
- X
- X Lpd may send banners and/or formfeed characters to the printer
- X without proper filtration.
- X
- X If banner pages are desired, then the psflpd filter must be used
- X with the of= printcap since only the of= filters process the
- X banners. If banner pages are not desired, then disable banners
- X with the :sh printcap.
- X
- X Disable unfiltered form-feeds with the :sf printcap or
- X possibly set :ff=\0.
- X
- X Different editions of lpd may (in rare circumstances) assign
- X nonstandard meanings to various printcaps. This may cause
- X unexpected printer action.
- X
- X Since it is difficult to properly process lpd-generated banner
- X pages, the recommended process is to suppress banner printing
- X with the :sh printcap.
- X
- X
- X 9. EXAMPLE OF A PSFPRINT.DEF FILE FOR USE WITH LPD
- X
- X # options for links to psflpd.
- X # link options comments
- X # ---- ---------------- -----------------------------
- X *psflpd p2up -2 # 2-up printing, default landscape
- X *psflpd p4up -4x # 4-up printing, default portrait
- X *psflpd p132x60 -c132 -l60 -w # 132 columns, 60 lines, landscape
- X *psflpd psource -2xn # source listings, 2-up, portrait
- X *psflpd post -z2xn # postscript source listings, 2-up
- X *psflpd plegal -g legal # standard print, legal paper
- X *psflpd pspread -g legal -p 8 -w # spreadsheets: legal,8pt,landscape
- X #
- X # printer definition for psf and friends
- X #
- X *printer
- X Sample Postscript Printer
- X *paper 2
- X Letter
- X statusdict begin lettertray end
- X 612 792 18 15 593 777
- X Legal
- X statusdict begin legaltray end
- X 612 1008 18 15 593 993
- X *order 1
- X Normal
- X *fonts 4
- X Courier
- X Helvetica
- X Times-Roman
- X ZapfChancery-MediumItalic
- X *slots 2
- X statusdict begin 1 setpapertray end
- X statusdict begin 2 setpapertray end
- X *eof
- X-----------------------
- XTony Field
- X(tony@ajfcal.cuc.ab.ca)
- END_OF_FILE
- if test 11083 -ne `wc -c <'Install.lpd'`; then
- echo shar: \"'Install.lpd'\" unpacked with wrong size!
- fi
- # end of 'Install.lpd'
- fi
- if test -f 'psfbanner.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'psfbanner.c'\"
- else
- echo shar: Extracting \"'psfbanner.c'\" \(12737 characters\)
- sed "s/^X//" >'psfbanner.c' <<'END_OF_FILE'
- X/* ta=4 */
- X/****************************************************************************
- X* p s f b a n n e r . c *
- X* *
- X* Print a banner page on a postscript printer *
- X* *
- X* The generated print stream is NOT minimally conforming as per Red Book. *
- X* *
- X* Tony Field. tony@ajfcal.cuc.ab.ca *
- X****************************************************************************/
- X
- X/*
- X * $Id: psfbanner.c,v 3.2 1992/01/19 05:50:33 ajf Exp ajf $
- X *
- X*/
- X
- X#include <stdio.h>
- X#include <string.h>
- X#include "ctp.h"
- X#include "psf.h"
- X#include "patchlevel.h"
- X
- X/* modifiy the following font selections if language changes
- X are needed in psfprint.def. Also enable the language translation
- X code at line 257 ( if (need_xlate) )
- X*/
- X
- X#define FONT1 "/Helvetica-BoldOblique findfont %d scalefont setfont\n"
- X#define FONT2 "/Helvetica-Bold findfont %d scalefont setfont\n"
- X#define FONT3 "/Courier findfont %d scalefont setfont\n"
- X#define FONT4 "/Helvetica-Bold findfont %d scalefont setfont\n"
- X
- X/* setup paper dimensions */
- X
- Xtypedef struct /* measurement in point */
- X{ char paper_name[60]; /* name of paper size (for command line) */
- X char paper_tray[200]; /* postscript operator to select this tray */
- X int width; /* portrait point width of paper */
- X int height; /* portrait point height of paper */
- X int lx, ly, ux, uy;
- X} measure;
- X
- Xmeasure *p; /* working set of parameters (points to something below) */
- X
- X /* standard paper sizes in portrait layout. */
- X
- Xmeasure page_types[NPAGE] =
- X{ { "letter",
- X "statusdict begin lettertray end",
- X 612, 792, 18, 15, 593, 777
- X },
- X { "legal",
- X "statusdict begin legaltray end",
- X 612, 1008, 18, 15, 593, 993
- X },
- X { "a4",
- X "statusdict begin a4tray end",
- X 595, 842, 18, 15, 578, 827
- X },
- X { "b5",
- X "statusdict begin b5tray end",
- X 516, 729, 18, 15, 497, 712
- X },
- X { "", /* end of paper list */
- X "",
- X 0, 0, 0, 0, 0, 0
- X }
- X};
- X
- Xchar slots[NSLOTS][200] =
- X{ "statusdict begin 1 setpapertray end",
- X "statusdict begin 2 setpapertray end",
- X "", "", "", ""
- X} ;
- Xint nslots = 2;
- X
- Xint X_INDENT = 30; /* points */
- Xint Y_INDENT = 30;
- Xint BIG_POINT = 60; /* changes to point size automatically scale */
- Xint MED_POINT = 35; /* the printout. */
- Xint SMALL_POINT = 15;
- Xint UX, UY, DX, DY, MAX_X, MAX_Y;
- X
- X/* The following arguments are received in the command line
- X argv[9] and argv[10] may be page size and paper tray specifications.
- X these could be:
- X
- X -b n = select paper bin n
- X -g size = selelct paper tray (letter, b5, etc)
- X*/
- X
- X#define Userid argv[1]
- X#define Name argv[2]
- X#define Requestid argv[3]
- X#define Printer argv[4]
- X#define Options argv[5]
- X#define Date argv[6]
- X#define Machineid argv[7]
- X#define Title argv[8]
- X
- Xchar *defref = NULL;
- X
- XFILE *outfp;
- Xunsigned char xlate[256]; /* translation vector */
- Xint need_xlate = 0; /* no default xlate */
- XFILE *pdef;
- Xvoid trim();
- X
- Xmain (argc, argv)
- Xint argc;
- Xchar *argv[];
- X{ int x, y, c, i, set_paper_tray, set_paper_bin, number, j;
- X char line[200];
- X
- X if (argc < 8)
- X usage ();
- X
- X for (i = 0; i < 256; i++)
- X xlate[i] = i;
- X
- X outfp = stdout;
- X pdef = NULL;
- X
- X /* get user specified def file with -u */
- X
- X for (i = 0; i < argc; i++)
- X { if (strncmp (argv[i], "-u", 2) == 0)
- X { if (strlen (argv[i]) > 2)
- X defref = argv[i] + 2;
- X else
- X defref = argv[i+1];
- X break;
- X }
- X }
- X if (i >= argc)
- X defref = PDEF;
- X
- X if ((pdef = fopen (defref, "r")) != NULL)
- X { char line_type[200];
- X
- X while (fgets (line, 200, pdef))
- X { if (strncmp (line, "*printer", 8) == 0)
- X break;
- X }
- X nslots = 0;
- X fgets (line, 200, pdef); /* skip printer name */
- X
- X while (fgets (line, 200, pdef))
- X { trim (line);
- X sscanf (line, "%s%d", line_type, &number);
- X
- X if (strcmp (line_type, "*paper") == 0)
- X { for (i = j = 0; i < number; i++)
- X { if (i >= NPAGE - 1)
- X { fgets (line, 200, pdef);
- X fgets (line, 200, pdef);
- X fgets (line, 200, pdef);
- X continue;
- X }
- X if (fgets (line, 200, pdef) == NULL)
- X bad_file();
- X line[59] = 0;
- X trim (line);
- X strcpy (page_types[i].paper_name, line);
- X if (fgets (line, 99, pdef) == NULL)
- X bad_file();
- X line[99] = 0;
- X trim (line);
- X strcpy (page_types[i].paper_tray, line);
- X if (fgets (line, 100, pdef) == NULL)
- X bad_file();
- X trim (line);
- X sscanf (line, "%d%d%d%d%d%d",
- X &page_types[i].width, &page_types[i].height,
- X &page_types[i].lx, &page_types[i].ly,
- X &page_types[i].ux, &page_types[i].uy);
- X j = i;
- X }
- X page_types[j+1].paper_name[0] = '\0';
- X }
- X
- X else if (strcmp (line_type, "*slots") == 0)
- X {
- X for (j = 0; j < NSLOTS; j++)
- X slots[j][0] = 0;
- X for (i = j = 0; i < number; i++)
- X { if (fgets (line, 200, pdef) == NULL)
- X bad_file();
- X if (i >= NSLOTS)
- X continue;
- X line[99] = 0;
- X trim (line);
- X strcpy (slots[i], line);
- X j = i;
- X }
- X nslots = j + 1;
- X }
- X
- X else if (strcmp (line_type, "*eof") == 0)
- X break;
- X }
- X }
- X
- X MAX_X = page_types[0].width;
- X MAX_Y = page_types[0].height;
- X set_paper_bin = 0;
- X set_paper_tray = -1;
- X
- X for (i = 9; i < argc; i++)
- X { if (argv[i][0] != '-')
- X continue;
- X c = argv[i][1];
- X switch (c)
- X {
- X case 'b':
- X if ((set_paper_bin = atoi (argv[i+1])) > nslots)
- X { fprintf (stderr, "paper bin greater than %d\n", nslots);
- X exit (1);
- X }
- X i++;
- X break;
- X
- X case 'g':
- X for (set_paper_tray = 0; page_types[set_paper_tray].paper_name[0]; set_paper_tray++)
- X { if (compare (argv[i+1], page_types[set_paper_tray].paper_name) == 0)
- X { MAX_X = page_types[set_paper_tray].width;
- X MAX_Y = page_types[set_paper_tray].height;
- X break;
- X }
- X }
- X if (page_types[set_paper_tray].paper_name[0] == '\0')
- X { fprintf (stderr, "Invalid paper size\n");
- X exit (1);
- X }
- X i++;
- X break;
- X
- X case 'u': /* already processed */
- X break;
- X
- X default: ;
- X }
- X }
- X
- X UX = X_INDENT;
- X UY = (MAX_Y - Y_INDENT);
- X DX = (MAX_X - 2 * X_INDENT);
- X DY = (BIG_POINT * 3);
- X
- X /* center text used for userid and job title print */
- X
- X send ("%!\n");
- X send ("/ctext { % center text: string x y dx\n");
- X send (" 2 div\n");
- X send (" /Dx exch def\n");
- X send (" /Yv exch def\n");
- X send (" /Xv exch def\n");
- X send (" dup stringwidth pop\n");
- X send (" 2 div\n");
- X send (" Dx exch sub\n");
- X send (" Xv add\n");
- X send (" Yv moveto\n");
- X send (" show\n");
- X send ("} def\n");
- X replacement_fonts(); /* get font translations */
- X send ("%%EndProlog\n");
- X
- X /* Uncomment the following code if languange translation is
- X needed for the following parameters
- X */
- X/*
- X if (need_xlate)
- X { xlate_string (Userid);
- X xlate_string (Name);
- X xlate_string (Requestid);
- X xlate_string (Printer);
- X xlate_string (Options);
- X xlate_string (Date);
- X xlate_string (Machineid);
- X xlate_string (Title);
- X }
- X*/
- X send ("%%Page: ? 1\n");
- X if (set_paper_bin)
- X printf ("%s\n", slots[set_paper_bin-1]);
- X
- X if (set_paper_tray >= 0)
- X printf ("%s\n", page_types[set_paper_tray].paper_tray);
- X
- X send ("/pg save def\n");
- X
- X /* draw a box for the userid */
- X
- X printf ("newpath\n");
- X printf ("%d %d moveto\n", UX,UY);
- X printf ("%d %d rlineto\n", DX, 0);
- X printf ("%d %d rlineto\n", 0, -DY);
- X printf ("%d %d rlineto\n", -DX, 0);
- X printf ("closepath\n");
- X printf ("4 setlinewidth\n");
- X printf ("stroke\n");
- X
- X /* center the userid and the job title */
- X
- X y = UY - DY / 2 - BIG_POINT / 2;
- X printf (FONT1, BIG_POINT);
- X printf ("(%s) %d %d %d ctext\n", Userid, X_INDENT, y, DX);
- X
- X y = UY - (DY + MED_POINT * 3);
- X printf (FONT2, MED_POINT);
- X printf ("(%s) %d %d %d ctext\n", Title, X_INDENT, y, DX);
- X
- X /* print other banner page parameters */
- X
- X x = X_INDENT;
- X y -= (MED_POINT * 2);
- X printf ("%d %d moveto\n", x,y);
- X sendnormal ("User: ");
- X sendbold (Name);
- X
- X y -= SMALL_POINT + (SMALL_POINT / 2);
- X printf ("%d %d moveto\n", x,y);
- X sendnormal ("Request ID: ");
- X sendbold (Requestid);
- X
- X y -= SMALL_POINT + (SMALL_POINT / 2);
- X printf ("%d %d moveto\n", x,y);
- X sendnormal ("Printer ID: ");
- X sendbold (Printer);
- X
- X y -= SMALL_POINT + (SMALL_POINT / 2);
- X printf ("%d %d moveto\n", x,y);
- X sendnormal ("Options: ");
- X sendbold (Options);
- X
- X y -= SMALL_POINT + (SMALL_POINT / 2);
- X printf ("%d %d moveto\n", x,y);
- X sendnormal ("Date: ");
- X sendbold (Date);
- X
- X y -= SMALL_POINT + (SMALL_POINT / 2);
- X printf ("%d %d moveto\n", x,y);
- X sendnormal ("Machine: ");
- X sendbold (Machineid);
- X
- X send ("showpage pg restore\n");
- X send ("%%Trailer\n");
- X exit (0);
- X}
- X
- X
- X/****************************************************************************
- X* send font selection information and text. *
- X****************************************************************************/
- X
- Xsend (s)
- Xchar *s;
- X{
- X while (*s)
- X fputc (*s++, outfp);
- X}
- X
- Xsendnormal (s)
- Xchar *s;
- X{
- X printf (FONT3, SMALL_POINT);
- X send ("(");
- X send (s);
- X send (")show\n");
- X}
- X
- Xsendbold (s)
- Xchar *s;
- X{
- X printf (FONT4, SMALL_POINT);
- X send ("(");
- X send (s);
- X send (")show\n");
- X}
- X
- X/****************************************************************************
- X* trim () *
- X* trucate garbage *
- X****************************************************************************/
- X
- Xvoid trim (s) /* trim trailing blanks and \n */
- Xchar *s;
- X{ int many;
- X
- X for (many = strlen (s) - 1; many >= 0; many--)
- X { if (isgraph (s[many]))
- X break;
- X else
- X s[many] = '\0';
- X }
- X}
- X
- X/****************************************************************************
- X* bad_file() *
- X****************************************************************************/
- X
- Xbad_file()
- X{
- X fprintf (stderr, "Bad %s file\n", defref);
- X exit (1);
- X}
- X
- X/****************************************************************************
- X* compare () *
- X* partial compare of two strings. *
- X****************************************************************************/
- X
- Xcompare (a,b)
- Xchar *a, *b;
- X{ int aa, bb;
- X
- X while (*a && *b)
- X { aa = *a++;
- X bb = *b++;
- X if (UCCHAR (aa) != UCCHAR (bb))
- X return (aa - bb);
- X }
- X return (0);
- X}
- X
- X
- X/****************************************************************************
- X* replacement_fonts() *
- X* read the text translation strings only. *
- X****************************************************************************/
- X
- Xreplacement_fonts ()
- X{ int found, xold, xnew;
- X char line[201];
- X char *x;
- X
- X if (pdef == NULL)
- X return;
- X found = 0;
- X while (fgets (line, 200, pdef)) /* skip printer name */
- X { if (strncmp (line, "%%PsfStart", 10) == 0)
- X { found = 1;
- X break;
- X }
- X }
- X if (found)
- X { while (fgets (line, 200, pdef)) /* read fonts, translate */
- X { if (strncmp (line, "%%PsfEnd", 8) == 0)
- X break;
- X if (strncmp (line, "%%translate", 11) == 0)
- X { x = strtok (line + 11, " ");
- X do
- X { xold = otoi (x) % 256;
- X xnew = otoi (x+4) % 256;
- X xlate[xold] = xnew;
- X } while (x = strtok (NULL, " "));
- X need_xlate = 1;
- X }
- X }
- X fclose (pdef);
- X pdef = NULL;
- X }
- X else
- X { fclose (pdef);
- X pdef = NULL;
- X }
- X return;
- X}
- X
- X/****************************************************************************
- X* octal to integer *
- X****************************************************************************/
- X
- Xint otoi (s)
- Xchar *s;
- X{
- X int v, p, quit;
- X
- X v = 0;
- X while (*s == ' ')
- X s++;
- X quit = 0;
- X while (*s)
- X { switch (*s)
- X {
- X case '0': p = 0; break;
- X case '1': p = 1; break;
- X case '2': p = 2; break;
- X case '3': p = 3; break;
- X case '4': p = 4; break;
- X case '5': p = 5; break;
- X case '6': p = 6; break;
- X case '7': p = 7; break;
- X default: quit = 1;
- X }
- X if (quit)
- X break;
- X v = (v << 3) + p;
- X }
- X return (v);
- X}
- X
- X
- X/****************************************************************************
- X* xlate_string () *
- X* translate the string according to the language translation vector *
- X****************************************************************************/
- Xxlate_string (s)
- Xunsigned char *s;
- X{
- X int sold;
- X
- X while (*s)
- X { sold = *s;
- X *s = xlate[sold];
- X s++;
- X }
- X}
- X
- X
- X/****************************************************************************
- X* usage() *
- X****************************************************************************/
- Xusage ()
- X{
- X fprintf (stderr, "Usage: psfbanner Userid Name Requestid Printer Options Date\n");
- X fprintf (stderr, " Machineid Title [-b n] [-g size] [-u f.def]\n");
- X fprintf (stderr, " where: Userid, Name, etc are passed by lpsched\n");
- X fprintf (stderr, " -b n = select paper bin n\n");
- X fprintf (stderr, " -g size = select paper size (letter, b5, etc)\n");
- X fprintf (stderr, " -u f.def = use this printer definition file\n");
- X exit (1);
- X}
- END_OF_FILE
- if test 12737 -ne `wc -c <'psfbanner.c'`; then
- echo shar: \"'psfbanner.c'\" unpacked with wrong size!
- fi
- # end of 'psfbanner.c'
- fi
- if test -f 'psfdoub.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'psfdoub.c'\"
- else
- echo shar: Extracting \"'psfdoub.c'\" \(17403 characters\)
- sed "s/^X//" >'psfdoub.c' <<'END_OF_FILE'
- X/* ta=4 */
- X
- X/****************************************************************************
- X* p s f d o u b . c *
- X* *
- X* Filter a "single sided" document to become a "double sided document" *
- X* *
- X* Tony Field. tony@ajfcal.cuc.ab.ca *
- X* *
- X* The basic algorithm for "print_book()" was based on a routine written *
- X* by Tom Neff (tneff@well.uucp) named "book" which printed 5.5x8.5 *
- X* double sided on an HP LaserJet. *
- X****************************************************************************/
- X/*
- X * $Id: psfdoub.c,v 3.2 1992/01/19 05:50:33 ajf Exp ajf $
- X *
- X*/
- X/* psfdoub prints simple reverse order or double sided.
- X
- X if the printer is "Normal", i.e. stacks face down, then psf
- X calls psfdoub to print simple reverse order or double sided.
- X
- X if the printer is "Reverse", i.e. stacks face up, then psf
- X calls psfdoub to print the file in reverse to make the page order
- X as though it were "Normal". It also calls psfdoub to print
- X in book format.
- X
- X Separate page traversal strategies are needed for "Normal"
- X and "Reverse" printers because of the different stacking methods.
- X
- X psfdoub will NOT print reversed order books or double sided!
- X All book and double sided output is in normal order as
- X far as the user is concerned.
- X
- X Double sided print requires two scans over the data. The first scan
- X by "psf" generates postscript output in normal (non-double sided)
- X form. A second scan examines the postscript and re-orders the output
- X to the printer. The second pass is always done by the "psfdoub" filter.
- X
- X Psf generates extra information to make it easy for psfdoub to work.
- X It simply constructs pointers to each of the %%Page: beginning
- X in the print file. (see function terminate_printer()) psfdoub
- X uses the pointers to "skip about" the file while it does the
- X actual page layout.
- X
- X If the target printer has two paper hoppers (i.e. #define HOPPER is
- X defined and "nslots > 2") then psf creates a temp file and system("psfdoub
- X fname") is called to immediately generate the double sided output.
- X The user does not have to manually invoke psfdoub.
- X
- X If HOPPER is not defined or nslots <= 1, psf simply creates an
- X appropriate output file and the user must manually invoke psfdoub to
- X print the file.
- X
- X Double sided print is forced into this routine. It would have been
- X simple except for the fact that 2-up "book" format is supported.
- X The excuse for this strategy is, of course, to minimize the amount
- X of file processing overhead when double sided printing is done.
- X
- X If the double sided printing is for 8.5x5.5 inch paper printed
- X two-up, then psf carefully forgets (in function set_frame())
- X to put in page scale, rotation, and translation information.
- X The psfdoub filter reads the page layout and carefully re-inserts
- X these when appropriate. If 2-up "books" are made, each logical
- X page becomes a separate page on the output temp file.
- X the psf-generated control information is assumed to be at the
- X end of the postscript print file. The postscript file must contain
- X a line like:
- X %PsfPtr: 21118
- X
- X If the %PsPtr line is missing, then the file is NOT a book format.
- X The format of this information is described in function read_control().
- X
- X psfdoub does little to normal double sided print other than to change
- X the order in which the pages are printed. It also adjusts the
- X %%Pages: value to reflect the actual page count printed.
- X
- X psfdoub re-inserts translation, rotation and scale information eliminated
- X by psf if the double sided print is to make an 8.5x5.5 "book".
- X
- X Of course, a bunch of "very ugly" logic is needed for the "book"
- X format to re-insert the postscript for page control - but it does work...
- X*/
- X
- X#include <stdio.h>
- X#include <string.h>
- X#include <signal.h>
- X#include <malloc.h>
- X#include <ctype.h>
- X#include "psf.h"
- X
- X/* If books are made by generating two print files with the -s side count
- X then set SIDECOUNT = 0 (i.e. no alternate paper hopper is available.
- X
- X If books are made by switching to the alternate print hopper for
- X the second side, then set SIDECOUNT = 3 (i.e. second hopper is available
- X
- X Leave this set to 0.
- X*/
- X
- X#define SIDECOUNT 0
- X
- Xstatic int nsheets, nhalves;
- Xstatic int row;
- Xstatic int lpage, rpage;
- Xvoid catch();
- Xvoid trim();
- X
- Xchar slots[NSLOTS][200] =
- X{ "statusdict begin 1 setpapertray end",
- X "statusdict begin 2 setpapertray end",
- X "", "", "", ""
- X} ;
- Xint nslots = 2;
- X
- Xchar order_default[20] = "Normal";
- Xchar order_normal[100] = "\0";
- Xchar order_reverse[100] = "\0";
- Xchar *order_command = NULL;
- X
- X
- Xchar line[LONG_STR + 1];
- Xchar scale[100];
- Xint max_frame;
- Xint landscape;
- Xint real_width;
- Xint height;
- Xint width;
- Xint dx_home[4];
- Xint dy_home[4];
- Xint npage;
- Xlong *pg_loc;
- Xlong trailer_loc;
- Xint phys_page;
- Xint side;
- Xint bookwork;
- Xint alternate_tray = 0;
- Xint second_side = 0;
- Xint reverse_requested; /* user requested reverse? */
- Xint reverse_order; /* actually reverse the sequence? */
- Xint need_showpage = 0; /* is pending show page needed? */
- X
- XFILE *input_fp;
- XFILE *output_fp;
- X
- Xchar *pgmname;
- Xchar *defref;
- X
- Xmain(argc, argv)
- Xint argc;
- Xchar *argv[];
- X{ int c, i, j;
- X extern char *optarg;
- X extern int optind;
- X FILE *pdef;
- X char *env_fname; /* environment specified output file */
- X char *getenv();
- X char in_fname[100];
- X
- X /* user may specify def file with -u */
- X
- X reverse_requested = 0;
- X for (i = 0; i < argc; i++)
- X {
- X if (strncmp (argv[i], "-u", 2) == 0)
- X { if (strlen (argv[i]) > 2)
- X defref = argv[i] + 2;
- X else
- X defref = argv[i+1];
- X break;
- X }
- X }
- X if (i >= argc)
- X { if ((defref = getenv ("PSFDEF")) == NULL)
- X defref = PDEF;
- X }
- X
- X if ((pdef = fopen (defref, "r")) != NULL)
- X { char line_type[200];
- X int number;
- X
- X while (fgets (line, 200, pdef))
- X { if (strncmp (line, "*printer", 8) == 0)
- X break;
- X }
- X nslots = 0;
- X fgets (line, 200, pdef); /* skip printer name */
- X
- X while (fgets (line, 200, pdef))
- X { trim (line);
- X sscanf (line, "%s%d", line_type, &number);
- X
- X if (strcmp (line_type, "*order") == 0)
- X { fgets (line, 200, pdef);
- X line[19] = 0;
- X trim (line);
- X strcpy (order_default, line);
- X if (number > 1)
- X { if (fgets (line, 200, pdef) == NULL)
- X bad_file();
- X trim (line);
- X line[99] = 0;
- X strcpy (order_normal, line);
- X if (fgets (line, 200, pdef) == NULL)
- X bad_file();
- X trim (line);
- X line[99] = 0;
- X strcpy (order_reverse, line);
- X }
- X }
- X
- X else if (strcmp (line_type, "*slots") == 0)
- X { for (j = 0; j < NSLOTS; j++)
- X slots[j][0] = 0;
- X for (i = j = 0; i < number; i++)
- X { if (fgets (line, 200, pdef) == NULL)
- X bad_file();
- X if (i >= NSLOTS)
- X continue;
- X line[99] = 0;
- X trim (line);
- X strcpy (slots[i], line);
- X j = i;
- X }
- X nslots = j + 1;
- X }
- X
- X else if (strcmp (line_type, "*eof") == 0)
- X break;
- X }
- X fclose (pdef);
- X }
- X
- X pgmname = argv[0];
- X if (argc == 1 || strcmp (argv[1], "-") == 0)
- X usage ();
- X
- X side = SIDECOUNT; /* print size 1, 2, or both = 3 */
- X
- X while ((c = getopt(argc, argv, "123vu:-")) != -1)
- X { switch (c)
- X {
- X case '1':
- X case '2':
- X case '3':
- X side = c - '0';
- X break;
- X case 'v':
- X reverse_requested = 1;
- X break;
- X case 'u': /* alread processed */
- X break;
- X default:
- X usage ();
- X }
- X }
- X if (strcmp (order_default, "Reverse") == 0)
- X { reverse_order = 1;
- X }
- X else
- X reverse_order = 0;
- X if (reverse_requested)
- X reverse_order = !reverse_order;
- X if (reverse_order && order_reverse[0])
- X order_command = order_reverse;
- X else if (reverse_order == 0 && order_normal[0])
- X order_command = order_normal;
- X else
- X order_command = NULL;
- X
- X if (reverse_requested && side != 0)
- X { fprintf (stderr, "Cannot print double sided or book in reverse order.\n");
- X exit (1);
- X }
- X
- X if (side == 3 && nslots < 2)
- X { fprintf (stderr, "Cannot use -3: only one output tray\n");
- X usage();
- X }
- X
- X if ( side >= 4)
- X { fprintf (stderr, "Print side must be 1, 2, or 3\n");
- X usage ();
- X }
- X
- X if (optind >= argc)
- X strcpy (in_fname, BOOKFILE);
- X else
- X strcpy (in_fname, argv[optind]);
- X
- X if (env_fname = getenv ("PSFLP"))
- X#if defined(MSDOS) || defined (__MSDOS__)
- X { if ((output_fp = fopen (env_fname, "wt")) == NULL)
- X#else
- X { if ((output_fp = fopen (env_fname, "w")) == NULL)
- X#endif
- X { fprintf (stderr, "Cannot open output file %s\n", env_fname);
- X exit (1);
- X }
- X }
- X else
- X output_fp = stdout;
- X
- X if ((pg_loc = (long *) malloc (sizeof (long) * MAX_PAGES)) == NULL)
- X { fprintf (stderr, "%s: cannot allocate enough memory\n", pgmname);
- X exit (1);
- X }
- X
- X if ((input_fp = fopen(in_fname, "r")) == NULL)
- X {
- X fprintf(stderr, "%s: Error opening %s!\n", pgmname, in_fname);
- X exit (1);
- X }
- X (void) signal (SIGINT, catch); /* for lpd quit */
- X read_control (input_fp);
- X get_prologue ();
- X if (reverse_order && side == 0)
- X reverse_pages ();
- X else if (bookwork)
- X print_book ();
- X else
- X print_double ();
- X get_trailer ();
- X exit (0);
- X}
- X
- X/****************************************************************************
- X* read_control() *
- X* Read the control information at the end of the file for the page *
- X* dimensions and byte address of the start of each page. *
- X* Each of the parameter lines is a comment with the form %Psfxxxx: yyyy *
- X****************************************************************************/
- X
- Xread_control (fp)
- XFILE *fp;
- X{ char tail[100];
- X int i, j;
- X long atol(), psfloc;
- X
- X /* %PsfPtr: xxx --> xxx is the pointer to the first %Psf... line
- X in the file. Seek to the indicated byte position to begin
- X reading the Psf generated information which looks like:
- X
- X %%Trailer <--- (a)
- X %%DocumentFonts: Courier
- X %%Pages: 8
- X %PsfScale: 0.63194 0.79558 scale <--- (b)
- X %PsfMargin: 2 1 612 769 626
- X %PsfHome: 0 0 0
- X %PsfHome: 1 626 0
- X %PsfHome: 2 0 0
- X %PsfHome: 3 0 0
- X %PsfPg: 0 405 <--- byte offsets to page
- X %PsfPg: 1 3885
- X %PsfPg: 2 7023
- X ...
- X %PsfPg: 9999 21072 <--- points to (a) above
- X %PsfPtr: 21118 <--- points to (b) above
- X <ctrl/d>
- X */
- X fseek (fp, -50L, 2);
- X fread (tail, 50, 1, fp);
- X if ((i = tscan (tail, "%PsfPtr:")) == -1)
- X { fprintf (stderr, "%s: File is not in psf book format\n", pgmname);
- X exit (1);
- X }
- X psfloc = atol (tail + i + 9); /* beginning of psf information */
- X fseek (fp, psfloc, 0);
- X
- X fgets (scale, 99, fp);
- X strcpy (tail, scale + 11); /* get rid of the %psf comment */
- X strcpy (scale, tail);
- X
- X /* fetch psf data. */
- X /* %PsfMargin: */
- X fscanf (fp, "%s %d %d %d %d %d", tail,
- X &max_frame, &landscape, &real_width, &height, &width);
- X
- X bookwork = (max_frame == 2 && landscape && !reverse_requested);
- X for (i = 0; i < 4; i++) /* %PsfHome: */
- X fscanf (fp, "%s %d %d %d", tail, &j, &dx_home[i], &dy_home[i]);
- X
- X npage = 0; /* %PsfPg: */
- X while (fscanf (fp, "%s %d %ld", tail, &i, &pg_loc[npage]) == 3)
- X {
- X if (i == 9999)
- X { trailer_loc = pg_loc[npage];
- X break;
- X }
- X npage++;
- X }
- X fseek (fp, 0L, 0);
- X}
- X
- X/****************************************************************************
- X* get_prologue() *
- X* Read the prologue and pass it directly to the output *
- X****************************************************************************/
- X
- Xget_prologue ()
- X{
- X fgets (line, LONG_STR, input_fp); /* skip the psf header */
- X fprintf (output_fp, "%%!PS-Adobe-\n"); /* write a valid header */
- X while (fgets (line, LONG_STR, input_fp) != NULL)
- X { if (strncmp (line, "%%Page:", 7) == 0)
- X break;
- X fputs (line, output_fp);
- X }
- X}
- X
- X/****************************************************************************
- X* get_trailer () *
- X* Read the trailer and pass it to the output. Modify the page count to *
- X* reflect the number of physical pages printed. *
- X* Remove any reference to the %Psf... lines. *
- X****************************************************************************/
- X
- Xget_trailer ()
- X{
- X if (phys_page == 0 || (bookwork && second_side))
- X fprintf (output_fp, "showpage pg restore\n");
- X if (alternate_tray == 2)
- X fprintf (output_fp, "%s\n", slots[0]);
- X fseek (input_fp, trailer_loc, 0);
- X while (fgets (line, LONG_STR, input_fp) != NULL)
- X { if (strncmp (line, "%%Pages:", 8) == 0)
- X fprintf (output_fp, "%%%%Pages: %d\n", phys_page);
- X else if (strncmp (line, "%Psf", 4) != 0)
- X fputs (line, output_fp);
- X }
- X}
- X
- X/****************************************************************************
- X* display_page() *
- X* Send all ouput that belongs to a specific page. For 8.5x5.5 books, *
- X* generate the scale, etc that was omitted by psf. Also enable the *
- X* alternate tray if it to be used. *
- X****************************************************************************/
- X
- Xdisplay_page (pgno, n)
- Xint pgno;
- Xint n;
- X{
- X fseek (input_fp, pg_loc[pgno], 0);
- X fgets (line, LONG_STR, input_fp);
- X if (n == 0)
- X {
- X if ((phys_page && bookwork) || need_showpage)
- X fprintf (output_fp, "showpage pg restore\n");
- X
- X if (alternate_tray == 1)
- X { alternate_tray = 2;
- X fprintf (output_fp, "%s\n", slots[1]);
- X }
- X fprintf (output_fp, "%%%%Page: ? %d\n", ++phys_page);
- X
- X if ((bookwork && max_frame == 2) || pgno >= npage)
- X { fprintf (output_fp, "/pg save def\n");
- X }
- X need_showpage = pgno >= npage;
- X }
- X
- X if (bookwork)
- X { if (n == 0)
- X {
- X fprintf (output_fp, "90 rotate 0 %d translate\n", -real_width);
- X fprintf (output_fp, "%s", scale);
- X }
- X fprintf (output_fp, "%d %d translate\n", dx_home[n], dy_home[n]);
- X }
- X
- X if (pgno < npage)
- X { while (fgets (line, LONG_STR, input_fp) != NULL)
- X { if(strncmp (line, "%%", 2) == 0)
- X break;
- X fputs (line, output_fp);
- X }
- X }
- X}
- X
- X
- X/****************************************************************************
- X* print_book() *
- X* print_book() is based on Tom Neff's (tneff@well.uucp) "book" *
- X* for the HP LaserJet *
- X* Scan the text to ensure that the 8.5x.5.5 pages are constructed in *
- X* such a way that a "book" is generated - simply staple in the middle . *
- X****************************************************************************/
- X
- Xprint_book ()
- X{ int done;
- X
- X nsheets = (npage+3)/4;
- X nhalves = nsheets*4;
- X phys_page = 0;
- X
- X if (side == 1 || side == 3)
- X { for (rpage=0, lpage=nhalves-1; rpage < lpage; rpage+=2, lpage-=2)
- X {
- X display_page (lpage, 0);
- X display_page (rpage, 1);
- X }
- X }
- X
- X if (side == 3)
- X alternate_tray = 1;
- X
- X if ((side == 2 || side == 3) && nhalves > 1)
- X { second_side = 1;
- X if (reverse_order)
- X { /* printer stacks face up */
- X for (rpage=nhalves-2, lpage=1; lpage < nhalves/2;
- X rpage-=2, lpage+=2)
- X {
- X display_page (lpage, 0);
- X display_page (rpage, 1);
- X }
- X }
- X else
- X { /* printer stacks face down */
- X for (rpage=nhalves/2, lpage=rpage-1; lpage >= 0;
- X rpage+=2, lpage-=2)
- X {
- X display_page (lpage, 0);
- X display_page (rpage, 1);
- X }
- X }
- X }
- X if (need_showpage)
- X fprintf (output_fp, "showpage pg restore\n");
- X}
- X
- X/****************************************************************************
- X* print double() *
- X* print double sided pages. first odd numbered, then even numbered. *
- X****************************************************************************/
- X
- Xprint_double ()
- X{ int apage;
- X
- X nsheets = (npage+1)/2;
- X phys_page = 0;
- X
- X if (side == 1 || side == 3)
- X { for (apage = 0; apage < nsheets; apage++)
- X { display_page (apage * 2, 0);
- X }
- X }
- X
- X if (side == 3)
- X alternate_tray = 1;
- X
- X if ((side == 2 || side == 3) && npage > 1)
- X { second_side = 1;
- X if (reverse_order)
- X { /* printer stacks face up */
- X for (apage = 0; apage < nsheets; apage++)
- X { display_page (apage * 2 + 1, 0);
- X }
- X }
- X else
- X { /* printer stacks face down */
- X for (apage = nsheets - 1; apage >= 0; apage--)
- X { display_page (apage * 2 + 1, 0);
- X }
- X }
- X
- X }
- X if (need_showpage)
- X fprintf (output_fp, "showpage pg restore\n");
- X}
- X
- X
- X/****************************************************************************
- X* reverse_pages () *
- X* normal print, reverse order of pages. *
- X****************************************************************************/
- X
- Xreverse_pages ()
- X{
- X int pgno;
- X
- X phys_page = 0;
- X for (pgno = npage-1; pgno >= 0; pgno--)
- X display_page (pgno, 0);
- X}
- X
- X
- Xtscan (s, t) /* search for string t in s */
- Xchar s[], t[];
- X{
- X int i, j, k;
- X for (i = 0; s[i] != '\0'; i++)
- X { for (j = i, k=0; t[k] != '\0' && s[j] == t[k]; j++, k++)
- X ;
- X if (t[k] == '\0')
- X return (i);
- X }
- X return (-1);
- X}
- Xusage ()
- X{
- X printf ("Usage: psfdoub -n [-v] [-u f.def] file\n");
- X printf (" where: n = side number to print\n");
- X printf (" -0 = not double sided (reverse print only)\n");
- X printf (" -1 = print side 1 only\n");
- X printf (" -2 = print side 2 only\n");
- X printf (" -3 = print both sides in one pass\n");
- X printf (" -v = reverse page order\n");
- X printf (" -u f.def = use this .def file\n");
- X printf (" file = print this file\n");
- X exit (0);
- X}
- X
- Xvoid trim (s) /* trim trailing blanks and \n */
- Xchar *s;
- X{ int many;
- X
- X for (many = strlen (s) - 1; many >= 0; many--)
- X { if (isgraph (s[many]))
- X break;
- X else
- X s[many] = '\0';
- X }
- X}
- X
- X
- X/********************************************************
- X* catch () *
- X* Catch SIGINT from lpd *
- X********************************************************/
- X
- Xvoid catch (signo)
- Xint signo;
- X{
- X fprintf (output_fp, "%c", 0x04);
- X exit (0);
- X}
- Xbad_file()
- X{
- X fprintf (stderr, "Bad %s file\n", defref);
- X exit (1);
- X}
- X
- END_OF_FILE
- if test 17403 -ne `wc -c <'psfdoub.c'`; then
- echo shar: \"'psfdoub.c'\" unpacked with wrong size!
- fi
- # end of 'psfdoub.c'
- fi
- echo shar: End of archive 7 \(of 9\).
- cp /dev/null ark7isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 9 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
- exit 0 # Just in case...
-